from schema.db_config import DBConnect
import os.path
from project_path import get_project_path
import json


db_connect = DBConnect()
# 初始化数据库结构
with open(os.path.join(get_project_path(), 'data', 'db_schema.json'), 'w', encoding='utf-8') as f:
    json.dump(db_connect.get_schema(), f, ensure_ascii=False, indent=2)


if __name__ == '__main__':
    sql_result = db_connect.execute_sql('your SQL query').values()
    print(str(list(sql_result)[0]))
    print(db_connect.get_schema('table_name'))
